package cn.starlightsoftware.sherly.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author 谷子毅
 * @date 2024/5/27
 */
@Data
@Component
@ConfigurationProperties(prefix = "minio")
public class MinioConfig {

    private String endpoint;

    private String accessKey;

    private String accessKeySecret;

    private String bucketName;

    private String staticDomain;

    @Bean
    public MinioClient createFileConfig() {
        return MinioClient.builder()
                .endpoint(endpoint)
                .credentials(accessKey, accessKeySecret)
                .build();
    }

}
